package com.moji;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.web.client.RestTemplate;

/**
 * @Description
 * @Author taoxiangshan
 * @Version 1.0
 **/

@SpringBootApplication

//开启服务发现
@EnableDiscoveryClient

//开启Feign支持
@EnableFeignClients
@Slf4j
//@EnableOpenApi
@MapperScan(basePackages="com.moji.mapper")
public class MoJiWebApplication {

    public static void main(String [] args){

        ConfigurableApplicationContext run = SpringApplication.run(MoJiWebApplication.class, args);
        Environment env=run.getEnvironment();
        log.info(MoJiWebApplication.class.getSimpleName()+" 启动成功，启动端口是：{},启动环境：{}",env.getProperty("server.port"),env.getActiveProfiles());
    }



    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

}

